{
	template:`
	  <div style="position:fixed;width:94%;height:90%;top:5%;left:3%;background-size:cover;background-position:center center;border-radius:20px;" :style="{backgroundImage:'url('+('Y'==system.backgroundType?(system.backgroundImage.imgPath||'resources/img/bg.jpg'):'')+')','boxShadow':'Y'==system.backgroundType?'10px 25px 40px #001':''}">
        <div :style="{height:(322+(codeVerify?70:0))+'px'}" style="width:600px;left:50%;bottom:15%;margin-left:-300px;position:fixed;background-color:000a;background-image:url(/resources/img/login.png);background-size:cover;border-radius:20px;background-position:center center;">
        </div>
	  	<div :style="{height:(322+(codeVerify?70:0))+'px'}" style="width:600px;left:50%;bottom:15%;margin-left:-300px;padding:20px 0 15px;position:fixed;background:linear-gradient(var(--colorPrimary4),var(--colorInfo4));border-radius:20px;box-shadow:0px 0px 30px var(--colorPrimary); opacity: 0.9;">
		  <a-row type="flex" justify="space-around" align="middle">
		    <a-col :span="12">
		     <div v-if="'YA'.indexOf(system.titleType)>=0" style="height:100px;text-align:center;"><img :src="system.titleIcon.path" height="90" /></div>
		     <div v-else style="height:100px;text-align:center;">
		        <m-icon name="icon-jifen" size="80" color="#fff" style="margin-top:-18px;"></m-icon>
		     </div>
		     <div style="font-size:20px;color:#fff;text-align:center;">{{system.backgroundTitle}}</div>
		     <div v-if="system.assistLogin=='Y'" class="padding-top text-center">
                 <a-space direction="vertical">
                    <a-radio-group v-model:value="loginType" :options="loginOptions" optionType="button" button-style="solid"/>
                    <a-input v-if="loginType=='assist'" placeholder="请输入登录帐号" v-model:value="assistAdmin.username" @pressEnter="doLogin" style="width:175px;background:#fff8;"></a-input>
                 </a-space>
		     </div>
		     <div class="padding-lr padding-top text-center" v-if="alertMessage"><a-alert :message="alertMessage" :type="alertType" show-icon /></div>
		     <a-flex v-if="loginType=='admin'" justify="center" align="center" gap="middle" style="padding-top:10px;">
		        <a-button v-if="registerPage" size="small" style="background:#ddd5;color:var(--colorPrimary);padding:0px 15px;" @click="openPage(registerPage,{},()=>{},'800px')">立即注册</a-button>
		        <a-button v-if="findPasswordPage" size="small" style="background:#ddd5;color:var(--colorPrimary);padding:0px 15px;" @click="openPage(findPasswordPage,{},()=>{},'800px')">找回密码</a-button>
		     </a-flex>
            </a-col>
		    <a-col :span="12">
		      <a-badge-ribbon :text="loginType=='admin'?'用户登录':'外协登录'" placement="start">
                <a-card class="obscure-glass" :bordered="false" :bodyStyle="{padding:'40px 30px 30px'}" style="background:#0002;border:solid 1.5px var(--colorPrimary);width:280px;border-radius:var(--borderRadius);">
                  <a-space direction="vertical" style="width:218px;">
                     <div style="color:#fff;">{{loginType=='admin'?'用户':'外协'}}账号：</div>
                     <a-input placeholder="帐号" v-model:value="login.username" ref="usernameRef" @pressEnter="doLogin" style="background:#fff8;"></a-input>
                     <div style="color:#fff;">{{loginType=='admin'?'用户':'外协'}}密码：</div>
                     <a-input type="password" placeholder="密码" v-model:value="login.password" ref="passwordRef" @pressEnter="doLogin" style="background:#fff8;"></a-input>
                     <div v-if="codeVerify" style="color:#fff;">验证码：</div>
                     <a-row v-if="codeVerify" type="flex" :gutter="4">
                       <a-col flex="auto"><a-input placeholder="验证码" v-model:value="imageCode" ref="imageCodeRef" @pressEnter="doLogin" style="width:132px;background: #fffd;font-weight: bold;"></a-input></a-col>
                       <a-col flex="1px"><div style="background: #fffd;border-radius: 2px;"><img height="28" style="margin:2px" :src="codeSrc"/></div></a-col>
                     </a-row>
                     <div style="text-align:right;">
                        <a-checkbox v-model:checked="autoLogin"><span style="color:#fff;">自动登录</span></a-checkbox>
                     </div>
                     <a-button type="primary" @click="doLogin" size="large" block>登录</a-button>
                  </a-space>
			    </a-card>
			  </a-badge-ribbon>
		    </a-col>
		  </a-row>
	  	</div>
	  </div>
	`,
	props: ['localeZh','param','parentVue'],
	data:function(){
		return {
			system:{},
			login:{},
			autoLogin:false,
            codeVerify:false,imageCode:'',
            codeSrc:'',
            assistAdmin:{},
            loginType:'admin',
            loginOptions:[{ label: '用户登录', value: 'admin' },{ label: '外协登录', value: 'assist' }],
            alertType:'',
            alertMessage:'',
            registerPage:'',
            findPasswordPage:''
		};
	},
	mounted(){
		this.codeVerify=this.param.codeVerify;
		this.registerPage=this.param.registerPage;
		this.findPasswordPage=this.param.findPasswordPage;
		if(this.codeVerify){
		    this.codeSrc="action/manage/adminLogin/getCaptchaCode?t="+new Date().getTime();
		}
		this.system=mo.system;
	},
	methods:{
	    setAlert:function(type,message){
	        this.alertType=type;
	        this.alertMessage=message;
	    },
	    doLogin:function(){
            if(!this.login.username){
                this.$refs['usernameRef'].focus();
                this.setAlert("warning","输入用户名");
                return;
            }
            if(!this.login.username){
                this.$refs['usernameRef'].focus();
                this.setAlert("warning","输入密码");
                return;
            }
            if(this.codeVerify&&!this.imageCode){
                this.$refs['imageCodeRef'].focus();
                this.setAlert("warning","输入验证码");
                return;
            }
	        if(this.loginType=='admin'){
	            this.doAdmin();
	        }else{
	            this.doAssist();
	        }
	    },
        doAdmin:function(){
            this.requestData('action/manage/adminLogin/doLogin',
                {model:this.login,imageCode:this.imageCode},
                function(data){
                    if(data.codeVerify) this.codeVerify=true;
                    if(data.code==0){
                        this.setAlert("success",data.msg);
                        mo.admin=data.model;
						mo.assist=data.assist||{};
						mo.orgGroup=data.orgGroup;
                        if(this.autoLogin){
                            document.cookie="admin_name="+mo.admin.username+"; expires="+new Date(new Date().getTime()+7*24*60*60*1000).toGMTString();
                            document.cookie="admin_key="+mo.admin.password+"; expires="+new Date(new Date().getTime()+7*24*60*60*1000).toGMTString();
                            document.cookie="admin_login=; expires="+new Date(new Date().getTime()+7*24*60*60*1000).toGMTString();
                        }
						//let desc="";
						//if(mo.orgGroup) desc="登录部门："+mo.orgGroup.org.name+"/"+mo.orgGroup.dept.name;
						//else desc="权限组："+mo.admin.adminGroup.name;
                        //this.remind('icon-bussinessman',desc,'你好！'+mo.admin.realname+(mo.assist.oid?('('+mo.assist.realname+')'):''));
                        this.back(true);
                    }else{
                        this.codeSrc="action/manage/adminLogin/getCaptchaCode?t="+new Date().getTime();
                        this.setAlert("error",data.msg);
                    }
                }.bind(this)
            );
        },
        doAssist:function(){
            this.requestData('action/manage/adminAssist/doLogin',
                {model:{username:this.login.username,password:this.login.password,admin:this.assistAdmin},imageCode:this.imageCode},
                function(data){
                    if(data.codeVerify) this.codeVerify=true;
                    if(data.code==0){
                        this.setAlert("success",data.msg);
                        mo.admin=data.model;
                        mo.assist=data.assist;
                        if(this.autoLogin){
                            document.cookie="admin_name="+mo.assist.username+"; expires="+new Date(new Date().getTime()+7*24*60*60*1000).toGMTString();
                            document.cookie="admin_key="+mo.assist.password+"; expires="+new Date(new Date().getTime()+7*24*60*60*1000).toGMTString();
                            document.cookie="admin_login="+mo.admin.username+"; expires="+new Date(new Date().getTime()+7*24*60*60*1000).toGMTString();
                        }
                        this.back(true);
                    }else{
                        this.codeSrc="action/manage/adminLogin/getCaptchaCode?t="+new Date().getTime();
                        this.setAlert("error",data.msg);
                    }
                }.bind(this)
            );
        }
	}
}